<?php
/*
 * 主要功能:
 *
 * dreamxyp(QQ:31996798) - PHP - class.html.php
 * coding:夏一平
 * 創建時間:2006-12-19
 */
 class html
 {
 	static public function option($array,$vars=null)
 	{
 		$rs 		= '';
 		if(array_keys($array) !== range(0, count($array) - 1))
 		{
 			foreach($array as $key => &$value)
 			{
 				$selected = $key == $vars ? 'selected="selected"':'';
 				$rs .='<option value="'.$key.'" '.$selected.'>'.$value.'</option>';
 			}
 		}else
 		{
 			foreach($array as &$value)
 			{
 				$selected = $value == $vars ? 'selected="selected"':'';
 				$rs .='<option value="'.$value.'" '.$selected.'>'.$value.'</option>';
 			}
 		}
 		return $rs;
 	}
 }
?>